home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 23.3 KB | 749 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWSemInt.cpp
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWSEMINT_H
- #include "FWSemInt.h"
- #endif
-
- // ----- Framework Includes -----
-
- #ifndef FWEXTMGR_H
- #include "FWExtMgr.h"
- #endif
-
- #ifndef FWPART_H
- #include "FWPart.h"
- #endif
-
- #ifndef PRSIGLUE_H
- #include "PRSIGlue.h"
- #endif
-
- #ifndef FWAPLEVT_H
- #include "FWAplEvt.h"
- #endif
-
- #ifndef FWDSCOPR_H
- #include "FWDscOpr.h"
- #endif
-
- #ifndef FWSCPCOL_H
- #include "FWScpCol.h"
- #endif
-
- #ifndef FWSCPTBL_H
- #include "FWScptbl.h"
- #endif
-
- #ifndef FWPRTSCP_H
- #include "FWPrtScp.h"
- #endif
-
- #ifndef FWSCPPRP_H
- #include "FWScpPrp.h"
- #endif
-
- #ifndef FWITERS_H
- #include "FWIters.h"
- #endif
-
- #ifndef FWCONTXT_H
- #include "FWContxt.h"
- #endif
-
- #ifndef FWEVENTU_H
- #include "FWEventU.h"
- #endif
-
- #ifndef FWINK_H
- #include "FWInk.h"
- #endif
-
- #ifndef FWOVLSHP_H
- #include "FWOvlShp.h"
- #endif
-
- #ifndef SOM_FW_OSemanticInterface_xh
- #include "SLSemInt.xh"
- #endif
-
- #ifndef FWSOMENV_H
- #include "FWSOMEnv.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_Module_OpenDoc_StandardExtensions_defined
- #include <StdExts.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_ODRegistry_defined
- #include <ODRgstry.xh>
- #endif
-
- #ifndef SOM_ODNameResolver_xh
- #include <NamRslvr.xh>
- #endif
-
- #ifndef SOM_ODObjectSpec_xh
- #include <ODObjSpc.xh>
- #endif
-
- #ifndef SOM_ODOSLToken_xh
- #include <ODOSLTkn.xh>
- #endif
-
- #ifndef SOM_ODSession_xh
- #include <ODSessn.xh>
- #endif
-
- // ----- Macintosh Includes -----
-
- #ifndef __AEOBJECTS__
- #include <AEObjects.h>
- #endif
-
- #ifndef __APPLEEVENTS__
- #include <AppleEvents.h>
- #endif
-
- #if defined(__MWERKS__) && GENERATING68K
- // A hack to work around a bug
- #pragma import list somNewObjectInstance
- #endif
-
- //========================================================================================
- // Runtime Information
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment fwsemevt
- #endif
-
- FW_DEFINE_AUTO(FW_CSemanticInterface)
-
- //========================================================================================
- // Key Matching Proc
- //========================================================================================
-
- static int FW_PrivCompareODDescTypes(void* p1, void* p2)
- {
- const ODDescType key1 = ((FW_CPrivDescTypeToFunctionPair*)p1)->fKey;
- const ODDescType key2 = ((FW_CPrivDescTypeToFunctionPair*)p2)->fKey;
-
- if (key1 == key2)
- return 0;
- else if (key1 > key2)
- return 1;
- else
- return -1;
- }
-
- //========================================================================================
- // class FW_CSemanticInterface
- //========================================================================================
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::FW_CSemanticInterface
- //---------------------------------------------------------------------------------------
-
- FW_CSemanticInterface::FW_CSemanticInterface(Environment* ev, FW_CPart* part) :
- fDefaultContainer(FW_DYNAMIC_CAST(FW_MPartScriptable, part)),
- fPart(part),
- fResolver(part->GetSession(ev)->GetNameResolver(ev)),
- fOSLFlags(kAEIDoMinimum),
- fUsingPredispatchProc(FALSE),
- fCoercionFuncMap(NULL)
- {
- FW_END_CONSTRUCTOR
-
- // OpenDoc 1.0 and 1.02 have a bug that prevents marking from working correctly.
- // The bug causes OpenDoc to look at the OSL flags of the part's containing
- // part when determining whether or not a part marks. This means that if a part
- // says it does marking, OpenDoc will treat it as if it does not, but will
- // treat all parts contained by that part as if they do.
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::~FW_CSemanticInterface
- //---------------------------------------------------------------------------------------
-
- FW_CSemanticInterface::~FW_CSemanticInterface()
- {
- FW_START_DESTRUCTOR
-
- delete fCoercionFuncMap;
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::RegisterCoercionFunction
- //---------------------------------------------------------------------------------------
-
- void FW_CSemanticInterface::RegisterCoercionFunction(Environment* ev,
- ODDescType toType,
- CoercionFunc func)
- {
- FW_UNUSED(ev);
- if (!fCoercionFuncMap)
- fCoercionFuncMap = new FW_CPrivDescTypeToFunctionMap(FW_PrivCompareODDescTypes);
-
- FW_ASSERT(!fCoercionFuncMap->Find(toType));
- fCoercionFuncMap->Add(toType, func);
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::RegisterCallbacks
- //---------------------------------------------------------------------------------------
-
- void FW_CSemanticInterface::RegisterCallbacks(Environment* ev)
- {
- RegisterCoercionFunction(ev, typeODFSemanticObject, FW_CSemanticInterface::PrivCoerceToSemanticObject);
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::CreateSOMInterface
- //---------------------------------------------------------------------------------------
-
- FW_OSemanticInterface* FW_CSemanticInterface::CreateSOMInterface(Environment *ev,
- FW_CPart *part,
- const char *name,
- void* refCon)
- {
- FW_UNUSED(name);
- FW_UNUSED(refCon);
- FW_OSemanticInterface* semInt = new FW_OSemanticInterface;
- semInt->InitODFSemanticInterface(ev, part->GetODPart(ev), part->GetSession(ev), this, FW_PrivGetSemanticInterfaceGlue());
-
- semInt->SetOSLSupportFlags(ev, fOSLFlags);
- semInt->UsingPredispatchProc(ev, fUsingPredispatchProc);
-
- return semInt;
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::AcquireSOMInterface
- //---------------------------------------------------------------------------------------
-
- FW_OSemanticInterface* FW_CSemanticInterface::AcquireSOMInterface(Environment* ev)
- {
- return (FW_OSemanticInterface*)fPart->GetExtensionManager(ev)->AcquireExtension(ev, kODExtSemanticInterface, FW_kDontCreateExtension);
- }
-
- //========================================================================================
- // Begin Callbacks
- //========================================================================================
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::CallEventHandler
- //---------------------------------------------------------------------------------------
-
- void FW_CSemanticInterface::CallEventHandler(Environment* ev,
- FW_CAppleEvent& event,
- FW_CAppleEvent& reply)
- {
- FW_MScriptable* targetObject = GetTargetObject(ev, event);;
-
- AEKeyword eventClass = event.GetEventClass();
- AEKeyword eventID = event.GetEventID();
-
- targetObject->HandleSemanticEvent(ev, fPart, eventClass, eventID, event, reply);
- targetObject->ReleaseScriptable();
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::CallCoercionHandler
- //---------------------------------------------------------------------------------------
-
- void FW_CSemanticInterface::CallCoercionHandler(Environment* ev,
- const FW_CDesc& theDesc,
- ODDescType toType,
- FW_CDesc& theResult)
- {
- FW_CPrivDescTypeToFunctionPair* pair = fCoercionFuncMap ? fCoercionFuncMap->Find(toType) : NULL;
- CoercionFunc func = pair ? pair->fValue : NULL;
-
- if (func)
- (func)(ev, this, theDesc, toType, theResult);
- else
- FW_THROW(FW_XException(errAECoercionFail));
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::CallPredispatchProc
- //---------------------------------------------------------------------------------------
-
- void FW_CSemanticInterface::CallPredispatchProc(Environment* ev,
- FW_CAppleEvent& event,
- FW_CAppleEvent& reply)
- {
- FW_UNUSED(ev);
- FW_UNUSED(event);
- FW_UNUSED(reply);
- FW_THROW(FW_XException(errAEEventNotHandled));
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::CallObjectAccessor
- //---------------------------------------------------------------------------------------
-
- void FW_CSemanticInterface::CallObjectAccessor(Environment* ev,
- ODDescType desiredClass,
- ODOSLToken* container,
- ODDescType containerClass,
- ODDescType form,
- FW_CDesc& selectionData,
- ODOSLToken* value)
- {
- FW_CDesc containedObjectToken(GetDescFromToken(ev, value));
- FW_CDesc containerToken(GetDescFromToken(ev, container));
-
- // OpenDoc 1.0 doesn't handle OSLSupportFlags correctly.
- // Instead of respecting our request for object marking,
- // we get a container token here that is a list built
- // by the OD OSL. For now, we'll simulate marking by
- // building generating a collection of marked objects ourselves.
-
- if (containerToken.IsList() && desiredClass == cProperty)
- {
- ODDescType whichProperty;
-
- selectionData >> whichProperty;
- FW_MScriptable* collection = CreateCollectionFromList(ev, fPart, containerToken, whichProperty);
- ::FW_InsertScriptableIntoDesc(collection, containedObjectToken);
- }
- else
- {
- FW_Boolean gotObject;
-
- if (containerClass == cPart)
- {
- FW_MPartScriptable* part = GetDefaultContainer();
- gotObject = part->GetObjectContainedInPart(ev, desiredClass, form, selectionData, containedObjectToken);
- }
- else
- {
- FW_MScriptable* containerObject;
-
- if (containerToken.IsNullDescriptor())
- containerObject = GetDefaultContainer();
- else
- containerObject = ::FW_ExtractScriptableFromDesc(containerToken);
-
- gotObject = containerObject->GetContainedObject(ev, fPart, desiredClass, form, selectionData, containedObjectToken);
- }
-
- if (!gotObject)
- FW_THROW(FW_XException(errAEEventNotHandled));
- }
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::CallCompareProc
- //---------------------------------------------------------------------------------------
-
- void FW_CSemanticInterface::CallCompareProc(Environment* ev,
- ODDescType oper,
- ODOSLToken* obj1,
- ODOSLToken* obj2,
- ODBoolean* result)
- {
- FW_CDesc desc1(GetDescFromToken(ev, obj1));
- FW_CDesc desc2(GetDescFromToken(ev, obj2));
-
- if (TypeIsSemanticObject(ev, desc1.DescriptorType()))
- {
- FW_MScriptable* semanticObject = ::FW_ExtractScriptableFromDesc(desc1);
- *result = semanticObject->CompareScriptableObjects(ev, fPart, oper, desc2);
- }
- else
- FW_THROW(FW_XException(errAEEventNotHandled));
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::CallCountProc
- //---------------------------------------------------------------------------------------
- void FW_CSemanticInterface::CallCountProc(Environment* ev,
- ODDescType desiredClass,
- ODDescType containerClass,
- ODOSLToken* container,
- ODSLong* result)
- {
- FW_CDesc containerToken(GetDescFromToken(ev, container));
-
- long elementCount = 0;
-
- if (containerClass == cPart)
- {
- elementCount = GetDefaultContainer()->CountElementsInPart(ev, desiredClass);
- }
- else
- {
- FW_MScriptable* containerObject = NULL;
-
- if (containerToken.IsNullDescriptor())
- containerObject = GetDefaultContainer();
- else
- containerObject = ::FW_ExtractScriptableFromDesc(containerToken);
-
- elementCount = containerObject->CountElements(ev, fPart, desiredClass);
- }
-
- *result = elementCount;
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::CallDisposeTokenProc
- //---------------------------------------------------------------------------------------
- void FW_CSemanticInterface::CallDisposeTokenProc(Environment* ev, ODOSLToken* unneededToken)
- {
- FW_CDesc token(GetDescFromToken(ev, unneededToken));
-
- if (TypeIsSemanticObject(ev, token.DescriptorType()))
- {
- FW_MScriptable* scriptableObject = ::FW_ExtractScriptableFromDesc(token);
- scriptableObject->ReleaseScriptable();
- token.Clear();
- }
- else
- FW_THROW(FW_XException(errAEEventNotHandled));
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::CallGetErrDescProc
- //---------------------------------------------------------------------------------------
- void FW_CSemanticInterface::CallGetErrDescProc(Environment* ev, ODDesc** errDesc)
- {
- FW_UNUSED(ev);
- FW_UNUSED(errDesc);
- FW_THROW(FW_XException(errAEEventNotHandled));
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::CallGetMarkTokenProc
- //---------------------------------------------------------------------------------------
- void FW_CSemanticInterface::CallGetMarkTokenProc(Environment* ev,
- ODOSLToken* dContainerToken,
- ODDescType containerClass,
- ODOSLToken* result)
- {
- FW_UNUSED(dContainerToken);
- FW_UNUSED(containerClass);
-
- // FW_DebugIdentifyPart(ev, fPart->GetLastActiveFrame(ev), FW_kRGBBlue);
-
- FW_CDesc collectionToken(GetDescFromToken(ev, result));
-
- FW_CScriptableCollection* collection = FW_NEW(FW_CScriptableCollection, ());
- ::FW_InsertScriptableIntoDesc(collection, collectionToken);
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::CallMarkProc
- //---------------------------------------------------------------------------------------
- void FW_CSemanticInterface::CallMarkProc(Environment* ev,
- ODOSLToken* objectToMarkToken,
- ODOSLToken* markingListToken,
- ODSLong index)
- {
- FW_UNUSED(index);
-
- // FW_DebugIdentifyPart(ev, fPart->GetLastActiveFrame(ev), FW_kRGBRed);
-
- FW_CDesc objectToMarkDesc(GetDescFromToken(ev, objectToMarkToken));
- FW_CDesc markingListDesc(GetDescFromToken(ev, markingListToken));
-
- FW_MScriptable* objectToMark = ::FW_ExtractScriptableFromDesc(objectToMarkDesc);
- FW_CScriptableCollection* collection =
- FW_DYNAMIC_CAST(FW_CScriptableCollection, ::FW_ExtractScriptableFromDesc(markingListDesc));
-
- collection->Add(objectToMark);
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::CallAdjustMarksProc
- //---------------------------------------------------------------------------------------
- void FW_CSemanticInterface::CallAdjustMarksProc(Environment* ev,
- ODSLong newStart,
- ODSLong newStop,
- ODOSLToken* markToken)
- {
- // FW_DebugIdentifyPart(ev, fPart->GetLastActiveFrame(ev), FW_kRGBGreen);
-
- FW_CDesc markingListDesc(GetDescFromToken(ev, markToken));
- FW_CScriptableCollection* collection =
- FW_DYNAMIC_CAST(FW_CScriptableCollection, ::FW_ExtractScriptableFromDesc(markingListDesc));
-
- collection->AdjustMarks(ev, newStart, newStop);
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::GetOSLSupportFlags
- //---------------------------------------------------------------------------------------
-
- ODSShort FW_CSemanticInterface::GetOSLSupportFlags(Environment* ev)
- {
- FW_UNUSED(ev);
- return fOSLFlags;
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::SetOSLSupportFlags
- //---------------------------------------------------------------------------------------
-
- void FW_CSemanticInterface::SetOSLSupportFlags(Environment* ev, ODSShort flags)
- {
- fOSLFlags = flags;
-
- FW_OSemanticInterface* semInt = AcquireSOMInterface(ev);
- if (semInt)
- {
- semInt->SetOSLSupportFlags(ev, flags);
- semInt->Release(ev);
- }
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::UsingPredispatchProc
- //---------------------------------------------------------------------------------------
-
- void FW_CSemanticInterface::UsingPredispatchProc(Environment* ev, ODBoolean usingNotUsing)
- {
- fUsingPredispatchProc = usingNotUsing;
-
- ODSemanticInterface* semInt = AcquireSOMInterface(ev);
- if (semInt)
- {
- semInt->UsingPredispatchProc(ev, usingNotUsing);
- semInt->Release(ev);
- }
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::CreateCollectionFromList
- //---------------------------------------------------------------------------------------
-
- FW_MScriptable* FW_CSemanticInterface::CreateCollectionFromList(Environment* ev,
- FW_CPart* part,
- const FW_CDesc& objectList,
- ODDescType whichProperty) const
- {
- FW_ASSERT(objectList.IsList());
-
- // FW_DebugIdentifyPart(ev, fPart->GetLastActiveFrame(ev), FW_kRGBPurple);
-
- FW_CScriptableCollection* collection = FW_NEW(FW_CScriptableCollection, ());
-
- FW_CDesc currentODToken;
- FW_CDesc currentToken;
- long itemsInList = objectList.GetItemCount();
-
- for (long index = 1; index <= itemsInList; index++)
- {
- currentODToken.Clear();
- currentToken.Clear();
-
- objectList.GetDescFromList(index, currentODToken);
- currentToken = GetDescFromToken(ev, currentODToken);
-
- FW_MScriptable* semObj = ::FW_ExtractScriptableFromDesc(currentToken);
-
- if (whichProperty != keyNoKey)
- {
- FW_CPropertyDesignator* propDesignator;
-
- propDesignator = FW_NEW(FW_CPropertyDesignator, (part, semObj, whichProperty));
- collection->Add(propDesignator);
- }
- else
- collection->Add(semObj);
- }
- return collection;
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::TypeIsSemanticObject
- //---------------------------------------------------------------------------------------
-
- FW_Boolean FW_CSemanticInterface::TypeIsSemanticObject(Environment* ev, ODDescType type) const
- {
- FW_UNUSED(ev);
- FW_Boolean result;
-
- switch (type)
- {
- case typeODFSemanticObject:
- case typeODFPropertyDesignator:
- case typeODFSemObjCollection:
- result = TRUE;
- break;
-
- default:
- result = FALSE;
- break;
- }
- return result;
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::GetDescFromToken
- //---------------------------------------------------------------------------------------
-
- ODDesc* FW_CSemanticInterface::GetDescFromToken(Environment* ev, ODOSLToken* token) const
- {
- return (fResolver->IsODToken(ev, token) ? fResolver->GetUserToken(ev, token) : token);
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::GetTargetObject
- //---------------------------------------------------------------------------------------
-
- FW_MScriptable* FW_CSemanticInterface::GetTargetObject(Environment* ev,
- FW_CAppleEvent& event)
- {
- FW_CDesc targetObjectDesc;
-
- if (event.HasDataKey(keyDirectObject))
- {
- FW_CDesc directObjectToken;
-
- event.GetDataByDesc(directObjectToken, keyDirectObject);
- targetObjectDesc = GetDescFromToken(ev, directObjectToken);
- }
- else
- {
- FW_CDesc subjectDesc;
-
- if (event.HasSubject())
- {
- event.GetSubject(subjectDesc);
- Resolve(ev, subjectDesc, targetObjectDesc);
- }
- }
-
- return GetScriptableFromToken(ev, targetObjectDesc);
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::Resolve
- //---------------------------------------------------------------------------------------
-
- void FW_CSemanticInterface::Resolve(Environment* ev,
- const FW_CDesc& objectSpec,
- FW_CDesc& odfToken,
- ODPart* contextPart) const
- {
- if (objectSpec.IsNullDescriptor())
- {
- odfToken.Clear();
- }
- else
- {
- FW_CDesc resolveToken;
-
- FW_TRY
- {
- fResolver->Resolve(ev, objectSpec, resolveToken, contextPart);
- resolveToken.SetOwnsODData(FALSE);
- odfToken = GetDescFromToken(ev, resolveToken);
- fResolver->DisposeToken(ev, resolveToken);
- }
- FW_CATCH_BEGIN
- FW_CATCH_EVERYTHING()
- {
- if (!resolveToken.IsNullDescriptor())
- fResolver->DisposeToken(ev, resolveToken);
- FW_THROW_SAME();
- }
- FW_CATCH_END
- }
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::GetScriptableFromToken
- //---------------------------------------------------------------------------------------
-
- FW_MScriptable* FW_CSemanticInterface::GetScriptableFromToken(Environment* ev,
- const FW_CDesc& odfToken) const
- {
- FW_MScriptable* scriptable = NULL;
- ODDescType tokenType = odfToken.DescriptorType();
-
- if (tokenType == kODStandardPartTokenType || odfToken.IsNullDescriptor())
- {
- scriptable = GetDefaultContainer();
- scriptable->AcquireScriptable();
- }
- else if (TypeIsSemanticObject(ev, tokenType))
- scriptable = ::FW_ExtractScriptableFromDesc(odfToken);
- else if (odfToken.IsList())
- scriptable = CreateCollectionFromList(ev, fPart, odfToken);
- else
- FW_THROW(FW_XException(errAEEventNotHandled));
-
- return scriptable;
- }
-
- //---------------------------------------------------------------------------------------
- // FW_DebugIdentifyPart:
- // This utility method is for debugging semantic event handling in nested parts.
- // A circle of the specified color will be briefly displayed in the top left
- // corner of the first facet of the specified frame. This method does not attempt
- // to redraw or invalidate the content area obscured by the circle.
- //
- // Note: This method may not be a permanent part of the ODF API.
- //---------------------------------------------------------------------------------------
-
- void FW_DebugIdentifyPart(Environment* ev, FW_CFrame* frame, const FW_CColor& color)
- {
- FW_CFrameFacetIterator iter(ev, frame);
- FW_CViewContext vc(ev, frame, iter.First(ev), NULL);
- FW_CRect rect(FW_kFixed0, FW_kFixed0, FW_IntToFixed(10), FW_IntToFixed(10));
-
- FW_CInk ink;
- ink.SetForeColor(color);
- ink.SetTransferMode(FW_kCopy);
- FW_COvalShape::RenderOval(vc, rect, FW_kFill, ink);
- FW_WaitFor(20);
- ink.SetTransferMode(FW_kErase);
- FW_COvalShape::RenderOval(vc, rect, FW_kFill, ink);
- }
-
- //========================================================================================
- // End Callbacks
- //========================================================================================
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::PrivCreate
- //---------------------------------------------------------------------------------------
-
- ODExtension* FW_CSemanticInterface::PrivCreate(Environment* ev, FW_CPart* part, const char* name, void* refCon)
- {
- return (part->GetSemanticInterface(ev)->CreateSOMInterface(ev, part, name, refCon));
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CSemanticInterface::PrivCoerceToSemanticObject
- //---------------------------------------------------------------------------------------
-
- void FW_CSemanticInterface::PrivCoerceToSemanticObject(Environment* ev,
- const FW_CSemanticInterface* semInt,
- const FW_CDesc& theDesc,
- ODDescType toType,
- FW_CDesc& theResult)
- {
- // built in up-cast to our basic event handler
- if (semInt->TypeIsSemanticObject(ev, theDesc.DescriptorType()))
- {
- theResult = theDesc;
- theResult.SetDescriptorType(toType);
- }
- else
- FW_THROW(FW_XException(errAECoercionFail));
- }
-